package lg.iu.transforms.input;

import lg.iu.ClassHooks;

import org.objectweb.asm.tree.ClassNode;

import wolf.iu.framework.ClassContainer;
import wolf.iu.framework.ClassesHandler;
import wolf.iu.framework.HooksList;
import wolf.iu.framework.hooks.AbstractTransform;
import wolf.iu.framework.hooks.HookState;

public class KeyboardTransform extends AbstractTransform {

    @Override
    public HookState execute(final ClassesHandler ch, final ClassContainer cc,
            final HooksList hooks) {
        final ClassNode node = cc.getNode();
        //node.interfaces.contains("java/awt/event/MouseListener")
        if (node.interfaces.contains("java/awt/event/KeyListener")) {
            hooks.setClassHook(ClassHooks.Keyboard, ch.getClass(node.superName));
            return HookState.Found;
        }
        //MouseListener ml = null;
        return HookState.WrongClass;
    }

}
